﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Register.aspx.cs" Inherits="WebApplication1.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>

    <link href="bootstrap-3.4.1-dist/css/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server" class="form-horizontal">
        <div "container">
            <h2 style="font-size:20px" class=" popover-title text-primary">注册页面</h2>
            <div class="panel panel-body">
                <table class="table table-hover">
                    <tr>
                        <td>用户名：</td>
                        <td>
                            <asp:TextBox ID="TbxUserName" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>密码：</td>
                        <td>
                            <asp:TextBox ID="TbxPassword" TextMode="Password" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>性别：</td>
                        <td>
                            <asp:RadioButton ID="RBtn_male" Text="男" runat="server" GroupName="Gender" Checked="True" />
                            <asp:RadioButton ID="RBtn_female" Text="女" runat="server" GroupName="Gender" />
                        </td>
                    </tr>
                    <tr>
                        <td>邮箱：</td>
                        <td>
                            <asp:TextBox ID="TbxEmail" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <asp:Button ID="btn" OnClientClick="return test();" CssClass="btn-primary" OnClick="btn_Click" runat="server" Text="注册" />
                        </td>
                    </tr>
                </table>
            </div>
            <asp:Label ID="LabelInfo" runat="server" Text=""></asp:Label>
            <script>
                var tbxUserName = document.getElementById("TbxUserName");
                var tbxPassword = document.getElementById("TbxPassword");
                var LabelInfo = document.getElementById("LabelInfo");
                function test() {
                    if (tbxUserName.value == "" || tbxPassword.value == "") {
                        alert("用户名或密码不能为空");
                        LabelInfo.innerText = "用户名或密码不能为空";
                        return false;
                    }
                    return true;
                }
            </script>
        </div>
    </form>
</body>
</html>
